package com.waghost.bridalgown.service.impl;

import com.waghost.bridalgown.dao.BannerDao;
import com.waghost.bridalgown.dao.CommDao;
import com.waghost.bridalgown.entity.Banner;
import com.waghost.bridalgown.entity.Comm;
import com.waghost.bridalgown.entity.Result;
import com.waghost.bridalgown.service.BannerService;
import com.waghost.bridalgown.service.CommService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

@AllArgsConstructor
@Service
public class ICommService implements CommService {

    private CommDao commDao;


    @Override
    public Result list() {
        return Result.success(commDao.selectList(null));
    }

    @Override
    public Result getId(Integer id) {
        return Result.success(commDao.getId(id));
    }

    @Override
    public Result add(Comm comm) {
        return Result.toAjax(commDao.insert(comm), "添加成功", "添加错误");
    }

    @Override
    public Result update(Comm comm) {
        return Result.toAjax(commDao.updateById(comm), "修改成功", "修改错误");
    }

    @Override
    public Result delete(Integer id) {
        return Result.toAjax(commDao.deleteById(id), "删除成功", "删除错误");
    }

}
